configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.cmake"
	"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app/Contents/Info.plist" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/icon.icns"
	"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app/Contents/Resources/${PACKAGE_NAME}.icns" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/launcher.cmake"
	"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app/Contents/MacOS/${PACKAGE_NAME_LONG}" @ONLY)
execute_process(COMMAND chmod "a+x" "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app/Contents/MacOS/${PACKAGE_NAME_LONG}")

add_custom_target(copy-fnt-files
	COMMAND "make" "-C" "${CMAKE_CURRENT_BINARY_DIR}/../../"
	"install" "DESTDIR=${CMAKE_CURRENT_BINARY_DIR}/temp"
	COMMAND "cd" "${CMAKE_CURRENT_BINARY_DIR}/temp/${CMAKE_INSTALL_PREFIX}"
	"&&" "cp" "-a" "*"
	"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app/Contents/"
	COMMENT "Copy program files"
	)
add_custom_target(create-dmg
	COMMAND "rm" "-f" "${PACKAGE_NAME_LONG_LC}-${PACKAGE_VERSION}-mac.dmg"
	COMMAND "/bin/bash" "${CMAKE_CURRENT_SOURCE_DIR}/create-dmg.sh"
	"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME_LONG}.app"
	"${_qt5_install_prefix}/../../"
	"${CMAKE_SOURCE_DIR}/README.rst"
	"${PACKAGE_NAME_LONG_LC}-${PACKAGE_VERSION}-mac"
	COMMENT "Create dmg file")
add_dependencies(create-dmg copy-fnt-files)
